using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NHibernate;
using Clanta.Core.Domain;
using System.Collections.Generic;

namespace Clanta.Web
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Clanta.Core.DataInterfaces.IDaoFactory daoFactory = new Clanta.Data.NHibernateDaoFactory(Server.MapPath(@"~/Config/ClantaNHibernate.config"));
            List<Customer> customers = daoFactory.CustomerDao.GetAll();

            //NHibernate.Cfg.Configuration configuration = new NHibernate.Cfg.Configuration();
            //configuration = configuration.Configure(@"C:\projects\Clanta\src\Clanta.Web\Config\ClantaNHibernate.config");
            //ISessionFactory sessionFactory = configuration.BuildSessionFactory();
            //using (ISession session = sessionFactory.OpenSession())
            //{
            //    ITransaction tx = session.BeginTransaction();

            //    //Customer customer = (Customer)session.Get(typeof(Customer), 1);

            //    //object i = session.CreateQuery("from Presentation").List();


            //    IQuery q = session.GetNamedQuery("GetCustomerByUserName");
            //    q = q.SetString("ApplicationName", Membership.ApplicationName);
            //    q = q.SetString("UserName", "jk");

            //    IList<Customer> customers = q.List<Customer>();

            //    //IList<Customer> customers =
            //    //    session.GetNamedQuery("GetCustomerByUserName")
            //    //        .SetString(0, Membership.ApplicationName)
            //    //        .SetString(1, System.Threading.Thread.CurrentPrincipal.Identity.Name)
            //    //        .List<Customer>();


            //    //customer.Name = customer.Name + "X";
            //    //session.SaveOrUpdate(customer);
            //    //Customer customer2 = new Customer();
            //    //customer2.Name = "John Doe";
            //    //session.Save(customer2);
            //    tx.Commit();
            //}

        }
    }
}
